#ifndef __border_option_napi_h__
#define __border_option_napi_h__

#include "imageknife_type.h"
#include <js_native_api.h>
#include <js_native_api_types.h>


struct BorderOption {
    // 0: all border or top, 1: right, 2: bottom, 3: left
    float width[4] = {0};
    float radius[4] = {0};
    uint32_t color[4] = {0};
    int32_t style[4] = {0};
    bool percentageWidth = false;
    bool percentageRadius = false;
    virtual ~BorderOption(){};
};


namespace ImageKnifeC {
struct BorderOptionNapi : public BorderOption {
    bool hasWidth = false;
    bool hasColor = false;
    bool hasRadius = false;
    bool hasStyle = false;

    void SetBorderOption(napi_env env, napi_value &value);
private:
    void ParseWidth(napi_env env, napi_value &value);
    void ParseRadius(napi_env env, napi_value &value);
    void ParseColor(napi_env env, napi_value &value);
    void ParseStyle(napi_env env, napi_value &value);

    float ParseLength(napi_env env, napi_value &value);
    uint32_t ParseResourceColor(napi_env env, napi_value &value);
    int32_t parseBorderStyle(napi_env env, napi_value &value);
};
}
#endif